package com.example.networktest;

/**
 * @PackageName: com.example.networktest
 * @ClassName: TestLeetcode
 * @Description:
 * @author: 林永健
 * @date: 下午7:44
 */
public class TestLeetCode {
    public static void main(String[] args) {
        System.out.println(translateNum(12258));
    }

    public static int translateNum(int num){
        String s = String.valueOf(num);
        int[] arr = new int[s.length()];
        for(int i = 0 ; i < s.length(); i++){
            arr[i] = s.charAt(i) - '0';
        }
        int[] dp = new int[s.length() + 1];
        dp[0] = 1;
        for(int i = 1; i < dp.length;i++){
            String str = String.valueOf(arr[i - 1]) +
                    arr[i];
            int temp = Integer.parseInt(str);
            if(temp > 25) {
                dp[i] = dp[i - 1] + 1;
            }else{
                dp[i] = dp[i - 1];
            }
        }
        return dp[s.length()];
    }
}
